package com.dingup.paike.dao;

import com.dingup.paike.adapter.pk.PkLessonInfoAdapter;
import com.dingup.paike.bean.dtobean.PkLessonInfoDTO;
import com.dingup.paike.bean.querybean.CurriculumScheduleQuery;
import com.dingup.paike.bean.querybean.TimeInterval;
import com.dingup.paike.bean.requestBean.pk.PkLessonInfoScreenPageBean;
import com.dingup.paike.mappers.BaseMapper;
import com.dingup.paike.model.pk.PkLessonInfo;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;
import java.util.Map;


public interface PkLessonInfoMapper extends BaseMapper<PkLessonInfo> {

    List<PkLessonInfo> getByPageBean(PkLessonInfoScreenPageBean pageBean);

    List<Map<String, Integer>> getLessonCount(@Param("ifPreLesson") Boolean ifPreLesson);

    void deleteBatchOfLesson(@Param("lessonIds") Integer[] lessonIds);

    PkLessonInfoAdapter getPkLessonInfoForFully(Integer id);

    void insertForBatch(@Param("list") List<PkLessonInfo> list);

    /**
     * 获取某天的所有课程
     *
     * @param before "2018-01-01"
     * @return
     */
    List<PkLessonInfo> getPkLessonByBeginTimeDay(@Param("before") String before);

    /**
     * 查看上课前一个小时没有发送消息的课节
     *
     * @param before
     * @param after
     * @return
     */
    List<PkLessonInfoAdapter> getPkLessonBetween(@Param("before") Date before,
                                                 @Param("after") Date after,
                                                 @Param("ifOnlineLesson") Boolean ifOnlineLesson);

    /**
     * 获取课程表
     *
     * @param query
     * @return
     */
    List<PkLessonInfoDTO> getCurriculumSchedule(CurriculumScheduleQuery query);

    /**
     * feign 获取学生的课堂报告列表
     *
     * @param studentId
     * @param classIds
     * @return
     */
    List<PkLessonInfoDTO> getPkLessonInfoDTOByStudentIdAndClassId(@Param("studentId") String studentId, @Param("classIds") List<Integer> classIds);

    /**
     * 根据 eeoLessonId 获取课节id;
     * @param eeoLessonId Integer
     * @return Integer
     */
    Integer getLessonIdByEeoLessonId(Integer eeoLessonId);

    /**
     * 获取某段时间内班级内所有课节
     *
     * @param classId
     * @param before
     * @param after
     * @return
     */
    List<PkLessonInfo> getPkLessonByClassId(@Param("classId") Integer classId,
                                            @Param("before") Date before,
                                            @Param("after") Date after);

    /**
     * 通过课节结束时间获取
     *
     * @param before
     * @param after
     * @return
     */
    List<PkLessonInfo> getPkLessonEndTimeBetween(@Param("before") Date before,
                                                 @Param("after") Date after);

    /**
     * 通过课节开始时间获取
     *
     * @param before
     * @param after
     * @return
     */
    List<PkLessonInfo> getPkLessonBeginTimeBetween(@Param("before") Date before,
                                                   @Param("after") Date after);

    /**
     * 获取某天 课节数
     *
     * @param teacherId
     * @param beginTime
     * @return
     */
    Integer getPkLessonCount(@Param("teacherId") String teacherId,
                             @Param("beginTime") Date beginTime);

    /**
     * 通过班级id删除课节
     *
     * @param classId
     */
    void deleteByClassId(Integer classId);


    List<PkLessonInfoDTO> getByUserIdsAndTimeInterval(@Param("userIds") List<String> userIds,
                                                      @Param("timeIntervals") List<TimeInterval> timeIntervals);
}